package test2;

import java.io.DataInputStream;
import java.io.DataOutputStream;
import java.io.IOException;
import java.net.ServerSocket;
import java.net.Socket;

public class server {
    public static void main(String[] args) throws IOException {
        ServerSocket ss = new ServerSocket(6587);
        Socket accept = ss.accept();
        DataInputStream dis = new DataInputStream(accept.getInputStream());
        String s = dis.readUTF();
        System.out.println(accept.getRemoteSocketAddress()+"上线了");
        System.out.println(s);

        DataOutputStream dos=new DataOutputStream(accept.getOutputStream());
        dos.writeUTF("服务器已经收到");
        dos.close();
        dis.close();
accept.close();
        ss.close();

    }
}
